package com.meowcook.service.impl;

import com.meowcook.dao.BoardMapper;
import com.meowcook.mapper.BoardPojoMapper;
import com.meowcook.pojo.po.Board;
import com.meowcook.pojo.vo.BoardVO;
import com.meowcook.service.IBoardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 28792
 * Date: 2025-04-30
 * Time: 16:03
 */
@Slf4j
@Service
public class BoardServiceImpl implements IBoardService {
    @Resource
    private BoardPojoMapper boardPojoMapper;

    @Resource
    private BoardMapper boardMapper;
    @Override
    public List<BoardVO> selectBoardList() {

        List<Board> boards = boardMapper.selectAll();
        List<BoardVO> boardVOS = new LinkedList<>();
        for (Board board : boards) {
            BoardVO boardVO = boardPojoMapper.toVO(board);
            boardVOS.add(boardVO);
        }
        return boardVOS;
    }
}
